import DList from "@/components/dlist";
export default {
  data() {
    return {
      loading: false,
      finished: false,
      page: 1,
      achievementList:[]
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    async getData() {
      if (this.loading === true || this.finished === true) {
        return;
      }
      this.loading = true;
      let {data,result,msg} = await $http.post("plugin.weighted_dividend.api.index.orderList",{page:this.page,time_type:this.$route.params.type});
      if (result === 0) {
        this.$toast(msg);
        return;
      }
      this.info = false;
      if (data.data.length === 0 || data.data.length < data.per_page || data.current_page === data.last_page) {
        this.finished = true;
      }
      this.achievementList.push(...data.data);
      this.page++;
      this.loading = false;
    },
    onLoad(){
      this.getData();
    },
  },
  components: { DList }
};